#!/usr/bin/python
#coding: utf-8

"""
此模块用来处理两个数据表中单一的字段
"""
import sys
sys.path.append("..")

from MySql_InterFace.AppMySql import ApplicationMySql

def GetUrls():
    app = ApplicationMySql()
    infoUrls = app.GetSoftInfo()
    print u"soft_info有%d行", len(infoUrls)

    surveyUrls = app.GetSoftSurvey()
    print u"soft_survey有%d行",  len(surveyUrls)

    classification = app.GetSoftClassification()
    print u"soft_classification有%d行", len(classification)

    # 把对应的url只存在于一张数据库表中的字段删除
    for info in infoUrls:
        if info not in surveyUrls:
            print u"soft_info数据库中需要删除url='%s'" % info
            app.DeleteInfoUrls(info[0])

    for survey in surveyUrls:
        if survey not in infoUrls:
            print u"soft_survey数据库中需要删除url='%s'" % survey
            app.DeleteSurveyUrls(survey[0])

if __name__ == "__main__":
    GetUrls()